<template>
  <el-dialog
    title="审核确认"
    :visible.sync="dialogVisible"
    width="520px"
    top="0"
    :before-close="cancelBtn"
    :close-on-click-modal="false"
  >
    <div class="info_1">一旦确认，不可修改。确认审核通过吗？</div>

    <span slot="footer" class="dialog-footer">
      <el-button class="cancel" @click="cancelBtn">取消</el-button>
      <el-button class="confirm" type="primary" @click="confirm">确认</el-button>
    </span>
  </el-dialog>
</template>

<script>
  import {CheckSignUpInfo} from "@/api/campSystem/campOper";

  export default {
    name: "PassDialog",
    props: {
      passDialogVisibleFu: Boolean,
      campsiteIdFu: [Number, String],
      idCardFu: [String, Number]
    },
    data() {
      return {
        dialogVisible: this.passDialogVisibleFu,
        dataObj: {
          examineStatus: 1,
          campsiteId: this.campsiteIdFu,
          idCard: this.idCardFu
        },
        isChecked: false, // 防重复点击
      };
    },
    methods: {
      confirm() {
        if (this.isChecked) {
          return;
        }
        this.isChecked = true;
        CheckSignUpInfo(this.dataObj)
          .then(response => {
            console.log(response);
            if (response.code != 200) {
              this.isChecked = false;
              return this.msgError(response.msg);
            }
            this.isChecked = false;
            this.msgSuccess(response.msg);
            this.dialogVisible = false;
            this.$emit("closePassDialog", this.dialogVisible, true);
          })
          .catch(error => {
            console.log(error);
            this.isChecked = false;
          });
      },
      // 取消,关闭弹框，修改父组件的值
      cancelBtn() {
        this.dialogVisible = false;
        this.$emit("closePassDialog", this.dialogVisible, false);
      },
    },
    watch: {
      passDialogVisibleFu() {
        this.dialogVisible = this.passDialogVisibleFu;
      },
      campsiteIdFu() {
        this.dataObj.campsiteId = this.campsiteIdFu;
      },
      idCardFu() {
        this.dataObj.idCard = this.idCardFu;
      },
    },
  };
</script>

<style scoped lang="scss">
</style>



